<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<%@ include file="header.jsp" %>
<title>修改密码 - 红高粱</title>
<script type="text/javascript" src="../m/js/loginValid.js"></script>
<script type="text/javascript" src="../m/js/user.js"></script>
<style type="text/css">
header{width:100%;overflow:hidden;background-size:cover; margin-top:15%}
header .avatar{width:45%;margin:0 auto; margin-top:20px; }
header .avatar img{ width:100%}
header .c_pass{float:left;width:35%; margin:5% 3.946% 5.5% 11.23%;}
header .c_pass img{ width:100%}
header .exit{float:left;width:35%;margin:5% 10.23% 5.5% 3.946%; }
header .exit img{ width:100%}
body{ background-image:url("../m/images/c_shop_bg2.png");}
*{ margin:0; padding:0;}
.menu_list a{text-shadow:#5f472d 0px 0px 2px; color:#fff; font-weight:bold; text-decoration: none;}
.menu_list{height:50px;float:left;width:100%;text-align:center;line-height:50px;background:url(../m/images/user_info_unchoose.png) repeat-x;overflow:hidden;margin-bottom:0px;}
.clear_both{clear:both;}
.pass{width:96%;text-align:center;margin:0 auto;overflow:hidden;box-shadow: 0px 0px 2px #26282b;background-color:none;border:0px solid #272a2d;border-radius:0em; color:#686868; margin-bottom:5px;}
.menu_content{line-height:38px;}
.border{background:url("../m/images/user_textfield_bg.png") repeat-x;background-position:bottom;}
.border{float: left; width:100%; overflow:hidden;}
.txt{width:90px;text-align:right; float:left;color:#fff;}
.txt2{width:70%;text-align:left;color:#fff;float:left;}
.href_style{text-decoration:none;}
.button{width:96%;margin:0 auto; margin-top:10px;}
input{border:none;font-size:1em; width:150px;background-color:transparent;color:#fff;}
#updateButton{background:url("../m/images/user_savepwd.png") no-repeat;background-position: center;height:45px;width:100%;background-size:contain; border:none;}
#cancel{background:url("../m/images/pass_cancle.png") no-repeat;height:45px;width:47.5%;background-size:contain; float:right;border:none;}
</style>
<script type="text/javascript">
	$(document).ready(function(){
		var userId = '${sessionScope.user.id}';
		loginValid(userId);
		
		//更新信息
		$("#updateButton").click(function(){
			var curPass = $('#curPass').val();
			var newPass = $('#newPass').val();
			var confirmPass = $('#confirmPass').val();
			$.ajax({
				url:"../user/updatePass",
				type:"POST",
				data:{curPass:curPass,newPass:newPass,confirmPass:confirmPass},
				dataType:"json",
				success:function(data){
					if(data.ok=='ok'){
						alert(data.msg);
						location.href = "../user/login?cid=${loginId}";
					}else{
						if(!!data.msg){
							alert(data.msg);
						}else{
							alert('修改失败，请稍后再试。');
						}
						//location.reload(true);
					}
				}
			});
		});
		
	});
</script>
</head>
<header>
	<div class="header">
		<div class="avatar"><a href="../user/backend"><img src="../m/images/logo.png"></a></div>
		<div class="c_pass"><a href="#"><img id="updatePass" src="../m/images/c_pass.png"></a></div>
		
		<div class="exit"><a href="#"><img id="userExit" src="../m/images/exit.png"></a></div>
	</div>
</header>
<body>
    <div style="width:100%;float:left;">
		<div class="menu_list">
			<a href="javascript:" onclick="location.href='./userUpdatePass?cid=${loginId}'" style="padding-left:0px;">修改密码</a>
		</div>
		
		<div class="menu_content">
		  <div  class="pass">
			<div class="border">
				<div class="txt">原密码：</div>
				<div class="txt2">
					<input type="password" name="curPass" id="curPass"></input>
				</div>	
			</div>
			<div  class="border" >
				<div class="txt">新密码：</div>	
				<div class="txt2">
					<input type="password" name="newPass" id="newPass"></input>
				</div>	
			</div>	
			<div class="border"> 
				<div class="txt">确认密码：</div>					
				<div class="txt2">
					<input type="password" name="confirmPass" id="confirmPass"></input>
				</div>	
			</div>
		  </div>	
		</div>
			<div class="button">
				<span><input type="button" id="updateButton"></span>
				<!-- <span><input type="button" id="cancel"></span> -->
			</div>	
	</div>
</body>
<div class="clear_both"></div>
<%@ include file="footer.jsp" %>
</html>